<html>
<body>

<!--   -->
<!-- Reading a File Line by Line

The fgets() function is used to read a single line from a file.  -->
<?php
$file = fopen("welcome.txt", "r") or exit("Unable to open file!");
//Output a line of the file until the end is reached
while(!feof($file))
  {
  echo fgets($file). "<br />";
  }
fclose($file);
?>



<!-- Reading a File Character by Character

The fgetc() function is used to read a single character from a file.   -->
<?php
$file=fopen("welcome.txt","r") or exit("Unable to open file!");
while (!feof($file))
  {
  echo fgetc($file);
  }
fclose($file);
?>
</body>
</html>